//
//  NSStringdrawAtPointVC.m
//  UILbrary
//
//  Created by mac on 17/5/8.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "NSStringdrawAtPointVC.h"

@interface NSStringdrawAtPointVC ()

@end

@implementation NSStringdrawAtPointVC

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];
    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, 0, 0);
    //UIGraphicsBeginImageContext(self.view.bounds.size);
    //    UIGraphicsGetCurrentContext();
    //    UIGraphicsPushContext(UIGraphicsGetCurrentContext());
    NSDictionary *attributes = @{NSForegroundColorAttributeName:[UIColor lightGrayColor],
                                 NSFontAttributeName:[UIFont systemFontOfSize:17.0]};
    
    NSString *title = @"白日依山尽";
    [title drawAtPoint:CGPointMake(100, 100) withAttributes:attributes];
    UIImage*image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    self.view.layer.contents = (__bridge id _Nullable)(image.CGImage);

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
